/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test;

import corejava.IncomTaxCalculator;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author sangnv
 */
public class IncomeTaxCalUnitTest {
    
    public IncomeTaxCalUnitTest() {
    }
    
    @BeforeClass
    public static void setUpClass() {
    }
    
    @AfterClass
    public static void tearDownClass() {
    }
    
    @Before
    public void setUp() {
    }
    
    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    // @Test
    // public void hello() {}
    @Test
    public void testCalIncomeTax() {
        IncomTaxCalculator cal = new IncomTaxCalculator();
        // income <5000
        double income = 4000;        
        assertEquals(0, cal.calIncomTax(income), Double.NaN);
        
        income =5000; // case income = 5000 then tax =0
        assertEquals(0, cal.calIncomTax(income), Double.NaN);
        
        income = 10000; // income =10000 then tax = 500;
        assertEquals(500, cal.calIncomTax(income), Double.NaN);

        income = 20000; // income =20000 then tax = 2000;
        assertEquals(2000, cal.calIncomTax(income), Double.NaN);
        
    }
}
